package com.mou.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.springframework.stereotype.Component;

import javax.validation.constraints.Email;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

@Data
@Component
public class User {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @Pattern(regexp = "^[\\u4e00-\\u9fa5a-zA-Z0-9_-]{3,20}$", message = "昵称格式不正确")
    private String nickname;
    @Pattern(regexp = "^[a-zA-Z0-9_-]{3,16}$", message = "用户名格式不正确")
    private String username;
    @Pattern(regexp = "^[a-zA-Z0-9_-]{6,16}$", message = "密码格式不正确")
    private String password;
    @Email
    private String email;
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;
    @Pattern(regexp ="^(https?:\\/\\/)?([a-zA-Z0-9_-]+(\\.[a-zA-Z]{2,})+)(\\/[^\\s]*)?$", message = "头像格式不正确")
    private String avatar;

    private String school;

    private Integer roleId;
    private Integer status;
    private LocalDateTime createTime;
    private String payPassword;
    private Double balance;
    private Integer deleted;
}
